<template>
	<view>
		<view class="inputs_info">
			<view class="ipt">
				<input v-model="params.title" @confirm='inputs' class="inputs" confirm-type="search" type="text" placeholder="输入标题" />
				<uni-icons type="search" size="24" color="#888888"></uni-icons>
			</view>
		</view>
		<swipergo :swiperid="swiperid" :upHeight="300" :upWith="716"></swipergo>
		<view class="content" v-if="textlist.length != 0 ">
			<view class="c_flex" v-for="(item,index) in textlist" :key="index" @click="goPage(item)">
				<view class="ts1" >
					<span class="ts2s">{{item.createTime.substr(0,10)}}</span>
					{{item.title}}
				</view>
			</view>
		</view>
		<kong v-if="textlist.length == 0"></kong>
	</view>
</template>

<script>
	import {
		getNotice
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				params:{
					pageNum: 1,
					pageSize: 20,
					title:''
				},
				swiperid: 6,
				textlist: []
			};
		},
		onLoad() {
			this.getList()
		},
		methods: {
			inputs(e){
				this.textlist = []
				this.params.title = e.detail.value
				getNotice(this.params).then(res=>{
					this.textlist.push(...res.rows)
				})
			},
			getList(){
				getNotice(this.params).then(res => {
					if (res.code == 200) {
						this.textlist.push(...res.rows)
					}
				})
			},
			onReachBottom(){
				this.params.pageNum ++ 
				this.getList()
			},
			goPage(item) {
				uni.navigateTo({
					url: `/pages/my/noticeinfo?id=${item.id}`
				})
			}
		}
	}
</script>

<style lang="less">
	page {
		background-color: #F0F0F1;
	}

	.content {
		background-color: #fff;
		width: 716rpx;
		margin: 0rpx auto;
		border-radius: 10rpx;
		padding: 30rpx 24rpx;
		box-sizing: border-box;
		.c_flex {
			border-bottom: 1px solid #eee;
			padding: 20rpx 0rpx;
			font-size: 28rpx;
			line-height: 44rpx;
			position: relative;
			.ts1 {
				font-size: 28rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2; //几行就填几
				-webkit-box-orient: vertical;
			}
			.ts2s {
				font-size: 28rpx;
				margin-right: 20rpx;
			}
		}
	}
</style>